package com.piesat.quake.business.device.mqtt.param;

import java.lang.reflect.Field;
import java.util.List;

public class ClassParseParam extends ParseParam {
    /**
     * 大小头，0：大头 1：小头
     */
    public Class<?> clazz;

    public List<? extends ParseParam> parseParams;

    public ClassParseParam() {
    }

    public ClassParseParam(Field field, Integer type) {
        super(field, type);
    }

    public ClassParseParam(Field field, Class<?> clazz, List<? extends ParseParam> parseParams) {
        super(field, 2);
        this.clazz = clazz;
        this.parseParams = parseParams;
    }

    @Override
    public int getLength() {
        int length = 0;
        for (ParseParam parseParam : parseParams) {
            length += parseParam.getLength();
        }
        return length;
    }
}